package com.gjj.abox.login;

import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;

import com.gjj.abox.BaseActivity;
import com.gjj.abox.database.R;

import java.util.Timer;
import java.util.TimerTask;

public class SplashActivity extends BaseActivity {
    private long splashTime = 2000;
    private Timer timer;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_splash);
        timer = new Timer();
        timer.schedule(timerTask, splashTime);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if(keyCode == KeyEvent.KEYCODE_BACK){
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

    TimerTask timerTask = new TimerTask() {
        @Override
        public void run() {
            goToNextPage();
        }
    };

    private void goToNextPage(){
        startActivity(new Intent(SplashActivity.this,LoginActivity.class));
        finish();
//        overridePendingTransition(R.anim.slide_right_in, 0);
    }

}
